<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [1, 2]
var arr1 = new Array()
//1. 字面量
var stu1 = {
    name: "张三",
    age: 19,
    say: function () {
        console.log("hello");

    }
}
var stu12 = {
    name: "李四",
    age: 20,
    say: function () {
        console.log("hello");

    }
}
stu1.sex = "男"
stu1.sing = function () {

}
console.log(stu1.name);
var n = "name"
console.log(stu1[n]);
stu1.say()
//2. 构造函数 可复用
function Student(name) {
    this.name = name;
    this.age;
    this.say = function () {
        console.log("你好");
    }
}
//静态成员
Student.run = function(){

}
var st2 = new Student("李四")
var st3 = new Student("王五")
console.log(st2.name);

//Object 创建
var obj = new Object()

for(var t in st2)
{
    console.log(st2[t]);
    
}
//值引用
// 值类型
var a = 10;
var b = a;
a++;
//console.log("a=" +a);	
//console.log("b="+b);			// 输出结果：10
// 引用类型--变量赋值
var obj = { a: 10 };
var obj1 = obj;
obj.a++;
console.log(obj1.a); 		// 输出结果：11

//传参
function test(a)
{
    a++
}
var b = 1
test(b)
function test1(obj)
{
    obj.a++
}
var o ={a:1}
test1(o)
    </script>
</body>
</html>